<template>
  <div class="form-setting-panel">
    <propaganda-page :propagandaData="productWarranty" v-if="!isOpenSystemIntegrationGray"></propaganda-page>

    <!-- start 标题 -->
    <h3 class="form-setting-panel-title">{{field.displayName}}</h3>   
    <!-- end 标题 -->
    <p class="form-design-warning">{{$t('common.form.tip.systemTemplateTips')}}</p>

      <!-- start 日期格式 -->
    <!-- <div class="form-setting-group form-setting-item">
      <h4 class="form-item-title">
        {{$t('common.form.setting.date.settingDes1')}} 
        <el-tooltip placement="top" popper-class="form-msg-setting-tooltip">
          <div slot="content">
            <div class="tooltip">YYYY-MM-DD HH:MM:SS (2018-06-27 13:24:21)</div>
          </div>
          <i class="iconfont icon-question"></i>
        </el-tooltip>
      </h4>
      <div class="form-item-box form-date-type">
        <div class="form-setting-item" >
          <el-select v-model="dateType" @change="update(dateType, 'dateType', true)" :placeholder="$t('common.form.placeHolder.date.pla1')" style="width: 200px;">
            <el-option  v-for="item in pickerMapOption" :label="item.label" :value="item.format" :key="item.format"></el-option>
          </el-select>
        </div>
      </div>
    </div> -->
    <!-- end 日期格式 -->

    <!-- start 校验 -->
    <div class="form-setting-group form-setting-item">
      <h4 class="form-item-title">{{$t('common.base.check')}}</h4>
      <div class="form-item-box">
        <!-- 必填 -->
        <form-required-setting :field="field" @input="update"></form-required-setting>
      </div>
    </div>
    <!-- end 校验 -->
  </div>
</template>

<script>
import SettingMixin from '@src/component/form/mixin/setting';
import FormSelectMixin from '@src/component/form/mixin/form.select';
import { settingProps } from '@src/component/form/components/props';
import PropagandaPage from '@src/component/compomentV2/PropagandaPage';

import { productWarranty } from '@model/enum/PropaganPageEnum'
import { getRootWindow } from '@src/util/dom'
import pickerOption from '@src/component/form/components/FormDate/pickerOption';

export default {
  name: 'form-quality-info-setting',
  mixins: [SettingMixin, FormSelectMixin],
  components: {
    PropagandaPage,
  },
  props: {
    ...settingProps,
    /** 用于获取FormDesign实例 */
    getContext: Function
  },
  computed: {
    // 是否开启系统集成灰度
     isOpenSystemIntegrationGray() {
      const RootWindow = getRootWindow(window);
      return Boolean(RootWindow?.grayAuth?.THIRD_APP);
    },
     /** 
  * @description 获取日期格式选择项
  */
    pickerMapOption() {
      return pickerOption;
    },
  },

  data(){
    return {
      index: this.field.options.length,
      batchModalShow: false, 
      optionText: '', // 批量编辑文本
      errMessage: null,
      productWarranty,
      dateType: this.field.setting.dateType || 'yyyy-MM-dd'
    }
  },
  methods: {
    updateDependencies(val){
      this.$emit('input', {prop: 'dependencies', value: val, operate: 'update'})
    },
    update(value, prop, isSetting = false) {
      this.$emit('input', {value, prop, isSetting});
    }
  },
}
</script>
